package jee.boot.entity.activiti;

import jee.boot.common.annotation.Column;
import jee.boot.common.annotation.Table;
import jee.boot.common.utils.JsonMapper;
import jee.boot.common.utils.MapUtils;
import jee.boot.common.utils.StringUtils;

import java.util.Map;

/**
 * 运行时流程变量(json结构)
 */
@Table(name="v_act_ru_variable")
public class VActRuVariable extends ActDataEntity<VActRuVariable> {

    /**
     * 执行实例ID
     */
    @Column(name = "EXECUTION_ID_")
    private String executionId;
    /**
     * 流程变量
     */
    @Column(name = "JSON_")
    private String json;

    public VActRuVariable() {
    }

    public VActRuVariable(String id) {
        super(id);
    }

    public String getExecutionId() {
        return executionId;
    }

    public void setExecutionId(String executionId) {
        this.executionId = executionId;
    }

    public String getJson() {
        return json;
    }

    public void setJson(String json) {
        this.json = json;
    }
    public Map<String,Object> toMap(){
        if(StringUtils.isNotBlank(json)){
            return JsonMapper.fromJsonString(json,Map.class);
        }
        return null;
    }
}
